<?php
/**
 * User: @lixu
 * Date: 2019-05-14
 * Time: 15:13
 */

namespace Biz\module\Search;


use Doraemon\tools\Curl;

class WikiSearch extends SearchAbstruct
{
    const TYPE_GOODS = 'wiki';

    public static function save($goodsInfo)
    {
        $host = self::getBasicUrl();
        if(!isset($goodsInfo['id'])) {
            return false;
        }
        $res = Curl::Request('POST', $host . '/add', ['form_params' => $goodsInfo]);
        return $res;
    }

    public static function getList($where)
    {
        $host = self::getBasicUrl();
        $list = [];
        $result = Curl::Request('POST', $host . '/list', ['form_params' => $where]);
        if($result['httpCode'] == 200) {
            return json_decode($result['data'], true);
        }

        return $list;
    }
}